#ifndef _GAMEOBJECT_H_
#define _GAMEOBJECT_H_



#include "CreatureData.h"


#include "GameTeam.h"


class GameCreature
{
public:

	friend class BattleManager;
	friend class BattleSession;
	friend class DexCompare;
	friend class MapManager;
	friend class MapScene;
	friend class ItemManager;
    friend class CreatureMoveData;

	GameCreature();
	virtual ~GameCreature();

	
	enum GameCreatureType
	{
		GCTGUEST = 0,
		GCTPLAYER,
		GCTPET,
		GCTENEMY,
		GCTNPC,
		GCTVIP,
		GCTGM,
		GCTBOSS,
		
		GCTCOUNT
	};

	enum GameCreatureState
	{
		GCSSTAND = 0,
		GCSSIT,
		GCSMOVE,
		GCSFIGHT,
		GCWAITCHANGEMAP,


		GCSCOUNT
	};


	fvoid					AddDanger( fint32 d )
	{
		mDanger += d;
	}

	virtual fvoid			SendMsg(){}
	virtual fvoid			PackMsg( fvoid* msg ){}

	virtual fvoid			Init();
	virtual fvoid			Release();

	fint32					GetGUID();
	fvoid					SetGUID( fint32 id );

	fvoid					SetType( GameCreatureType type );
	GameCreatureType		GetType();

// 	fbool					IsRun();
// 	fvoid					SetRun( fbool b );

	fbool					CheckState( GameCreatureState state );
	fvoid					SetState( GameCreatureState state );
	GameCreatureState		GetState();

	virtual fint32			GetExp();
	virtual fvoid			CheckLevelUp();
	fvoid					AddEXP( fint32 exp );

	CreatureMoveData&		GetMoveData();
	CreatureData&			GetData();
	CreatureFightData&		GetFightData();

	BattleSessionCommand&	GetCommand();

	
	GameTeam*				GetTeam();
	fvoid					SetTeam( GameTeam* team );

	//////////////////////////////////////////////////////////////////////////

	fbool					IsFall();
	fvoid					SetFall( fbool b );

	fvoid					ClearFightStatus();

	fbool					CheckStatus( SAStatusType s );
	fvoid					SetStatus( SAStatusType s );

	fbool					IsFighting();
	virtual fvoid			StartFight();
	virtual fvoid			EndFight();

	fvoid					InitBaseData();
	virtual fvoid			UpdateFightData();

	virtual fvoid			AddHp( fint32 hp );
	virtual fvoid			AddMp( fint32 mp );
	virtual fvoid			AddCharm( fint32 c );

	//////////////////////////////////////////////////////////////////////////

protected:

	fint32					mDanger;

	GameTeam*				mTeam;


	fint32					mTempExp;

	CreatureData			mData;
	CreatureFightStatus		mFightStatus;
	CreatureFightData		mFightData;
	CreatureMoveData		mMoveData;

	GameCreatureState		mState;
	GameCreatureType		mType;

	BattleSessionCommand	mCommand;
};

typedef map< fint32 , GameCreature* > GameCreatureMap;
typedef map< fint32 , GameCreature* >::iterator GameCreatureMapIter;

typedef vector< GameCreature* > GameCreatureVector;
typedef vector< GameCreature* >::iterator GameCreatureVectorIter;

typedef list< GameCreature* > GameCreatureList;
typedef list< GameCreature* >::iterator GameCreatureListIter;


#endif

